<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>14.组件模板分离</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <cpn2></cpn2>
    </div>
    <!-- script的type必须是text/x-template -->
    <script type="text/x-template" id="cpn1">
      <div>hhh</div>
    </script>

    <!-- template写法 -->
    <template id="cpn2">
      <div>hhh</div>
    </template>

    <script>
      new Vue({
        el: "#app",
        data: {
          msg: "hello",
        },
        components: {
          cpn1: {
            template: "#cpn2",
          },
        },
      });
    </script>
  </body>
</html>
